package org.ladybug.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.ladybug.dao.persistence.InfoUtente;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class DAOServiceImpl extends HibernateDaoSupport implements DAOService{

	public List findByCriteria(DetachedCriteria criteria) {
		return getHibernateTemplate().findByCriteria(criteria);
	}

	public List loadAll(Class entityClass) {
		return getHibernateTemplate().loadAll(entityClass);
	}

	public Object load(Class entityClass,Serializable id) {
		Object obj =  getHibernateTemplate().load(entityClass, id);
//		System.out.println(((InfoUtente)obj).getNome());
		return obj;
	}

	public Object get(Class entityClass, Serializable id) {
		return getHibernateTemplate().get(entityClass, id);
	}

	public Serializable save(Object entity) {
		return getHibernateTemplate().save(entity);
	}

	public void saveOrUpdate(Object entity) {
		getHibernateTemplate().saveOrUpdate(entity);
	}

}
